import 'package:flutter/material.dart';

class Widget_IgnorePointer_Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("IgnorePointer"),
          ),
          body: Center(
            child: Listener(
              child: IgnorePointer(
                  child: Listener(
                    child: Container(
                      width: 200,
                      height: 200,
                      color: Colors.orange,
                    ),
                    onPointerDown: (event) =>
                        debugPrint("内层点击事件"),
                    onPointerMove: (event) =>
                        debugPrint("onPointerMove:  " + event.delta.toString()),
                    onPointerUp: (event) =>
                        debugPrint("onPointerUp:  " + event.toString()),
                  )
              ),
              onPointerDown: (event) => debugPrint("外层点击事件"),
            ),
          )
      ),
    );
  }
}
//按下什么都不会打印-------
/**
 * 忽略触摸事件，
 * IgnorePointer和AbsorbPointer，这两个Widget都能阻止子树接收指针事件，不同的是AbsorbPointer本身是可以接收指针事件的(但其子树不行)，而IgnorePointer本身就不可以接收指针事件
 * const IgnorePointer({
    Key key,
    this.ignoring = true,//控制是否忽略
    this.ignoringSemantics,
    Widget child,
    })
 */
